<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">  
  <title>鲜花列表</title>
 </head>
 <body>
 <?php
  require_once('inc_flower.php');
  connect();
 

  $sql = 'select * from flower ';


  //echo $sql.'<br/>';  

  $result = fetch_array($sql); 


 ?>

 <div class="container">

   <div class="row">

     <center><h1 class="text-center">鲜花列表</h1></center>

     <table class="table table-hover" align="center"> 

     <tr>

       <th>鲜花标题</th> 

       <th>鲜花产地</th>

       <th>添加鲜花时间</th>

       <th>点击量</th> 

     </tr>
     <?php
      foreach ($result as $row) {

       echo '<tr>';

       echo '<td>'.'<a href="detail.php?id='.$row['ctf_id'].' ">'.$row['ctf_title'].'</a>'.'</td>';  

       echo '<td>'.$row['ctf_place'].'</td>';

       echo '<td>'.$row['ctf_adddate'].'</td>';

       echo '<td>'.$row['ctf_hint'].'</td>';   

       echo '
       <td><a href="#">修改</a>|<a href="delflower.php?id='.$row['ctf_id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';

       echo '</tr>';  

      }

      echo '</table>';  

      $totalrows = count($result);

      echo "<table align='center'><tr><td>共有{$totalrows}种鲜花</td></tr></table>";   

     ?>
  <form action="search.php" method="post" align="center">
  <input type="text" name="ctf_title">
  <input type="submit" class="form-control" value="搜索"></input>
  </form>
  </div>

 </div>

 </body>

</html>